<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="/includes.jsp"%>

<% ProjectValue projectValue = (ProjectValue)session.getAttribute("projectValue"); %>

<div class="layout">
    <div style="float: right; width=0%;">
        <table class="details" cellspacing="0">
            <tr>
                <th class="details">ID#</th>
                <td class="details"><beans:write name="projectValue" property="taskValue.nodeValue.nodeId"/></td>
            </tr>
            <tr>
                <th class="details">Creator</th>
                <td class="details">
                    <html:link action="showNode.do" paramId="nodeId" paramName="projectValue" paramProperty="taskValue.creatorContactableValue.nodeValue.nodeId">
                        <beans:write name="projectValue" property="taskValue.creatorContactableValue.nodeValue.name"/>
                    </html:link>
                </td>
            </tr>
            <tr>
                <th class="details">Owner</th>
                <td class="details">
                    <html:link action="showNode.do" paramId="nodeId" paramName="projectValue" paramProperty="taskValue.ownerContactableValue.nodeValue.nodeId">
                        <beans:write name="projectValue" property="taskValue.ownerContactableValue.nodeValue.name"/>
                    </html:link>
                </td>
            </tr>
            <tr>
                <th class="details">Sponsor</th>
                <td class="details">
                    <html:link action="showNode.do" paramId="nodeId" paramName="projectValue" paramProperty="sponsorPersonValue.contactableValue.nodeValue.nodeId">
                        <beans:write name="projectValue" property="sponsorPersonValue.contactableValue.nodeValue.name"/>
                    </html:link>
                </td>
            </tr>
            <tr>
                <th class="details">Primary Contact</th>
                <td class="details">
                    <html:link action="showNode.do" paramId="nodeId" paramName="projectValue" paramProperty="primaryContactPersonValue.contactableValue.nodeValue.nodeId">
                        <beans:write name="projectValue" property="primaryContactPersonValue.contactableValue.nodeValue.name"/>
                    </html:link>
                </td>
            </tr>
            <tr>
                <th class="details">Priority</th>
                <td class="details">
                    <% int val2 = 15 - ((ProjectValue)projectValue).getTaskValue().getPriority().intValue() * 15 / 100; %>
                    <div class="histogram" style="width: <beans:write name="projectValue" property="taskValue.priority"/>%; background-color:#f<%=Integer.toHexString(val2) %><%=Integer.toHexString(val2) %>">&nbsp;</div>
                </td>
            </tr>
            <tr>
                <th class="details"><img src='<html:rewrite page='/icons/task-16x16.png'/>'/>Task Type</th>
                <td class="details">
                    <html:link action="showNode.do" paramId="nodeId" paramName="projectValue" paramProperty="taskValue.taskStateMachineValue.nodeValue.nodeId">
                        <beans:write name="projectValue" property="taskValue.taskStateMachineValue.nodeValue.name"/>
                    </html:link>
                </td>
            </tr>
            <tr>
                <th class="details"><img src='<html:rewrite page='/icons/state-16x16.png'/>'/>State</th>
                <td class="details">
                    <html:link action="showNode.do" paramId="nodeId" paramName="projectValue" paramProperty="taskValue.stateValue.nodeValue.nodeId">
                        <beans:write name="projectValue" property="taskValue.stateValue.nodeValue.name"/>
                    </html:link>
                </td>
            </tr>
            <tr>
                <th class="details"><img src='<html:rewrite page='/icons/status-16x16.png'/>'/>Status</th>
                <td class="details">
                    <html:link action="showNode.do" paramId="nodeId" paramName="projectValue" paramProperty="taskValue.statusValue.nodeValue.nodeId">
                        <beans:write name="projectValue" property="taskValue.statusValue.nodeValue.name"/>
                    </html:link>
                </td>
            </tr>
            <tr>
                <th class="details">Duration</th>
                <beans:define id="duration" value="<%=TaskValueToString.expectedDurationToString(projectValue.getTaskValue())%>"/>
                <td class="details"><beans:write name="duration"/></td>
            </tr>
            <tr>
                <th class="details">Remaining</th>
                <beans:define id="remaining" value="<%=TaskValueToString.expectedDurationToString(projectValue.getTaskValue().getRemainingDuration_min().intValue())%>"/>
                <td class="details"><beans:write name="remaining"/></td>
            </tr>
            <tr>
                <th class="details">Period</th>
                <td class="details">
                    <beans:write name="projectValue" property="taskValue.startDate" format="yyyy-MM-dd HH:mm"/>
                    to<br/>
                    <beans:write name="projectValue" property="taskValue.stopDate" format="yyyy-MM-dd HH:mm"/>
                </td>
            </tr>
            <tr>
                <th class="details">% Complete</th>
                <td class="details">
                    <div class="histogram" style="width: <beans:write name="projectValue" property="taskValue.percentageComplete"/>%;">&nbsp;</div>
                </td>
            </tr>
            <tr>
                <th class="details">Interested</th>
                <td class="details">
                    <logic:iterate name="interestedContactableValues" id="interested">
                        <html:link action="showNode.do" paramId="nodeId" paramName="interested" paramProperty="nodeValue.nodeId">
                            <beans:write name="interested" property="nodeValue.name"/><br/>
                        </html:link>
                    </logic:iterate>
                </td>
            </tr>
            <tr>
                <th class="details">Responsible</th>
                <td class="details">
                    <logic:iterate name="responsibleContactableValues" id="responsible">
                        <html:link action="showNode.do" paramId="nodeId" paramName="responsible" paramProperty="nodeValue.nodeId">
                            <beans:write name="responsible" property="nodeValue.name"/><br/>
                        </html:link>
                    </logic:iterate>
                </td>
            </tr>
        </table>
    </div>
    <img src="<html:rewrite page='/icons/project-32x32.png'/>"/><span class="node-name"><beans:write name="projectValue" property="taskValue.nodeValue.name"/></span>
    <logic:iterate name="projectHistory" property="transactions" id="transaction">
        <p class="history"><span class="history-date">
            <b><beans:write name="transaction" property="type"/></b>
            <beans:write name="transaction" property="date" format="yyyy-MM-dd HH:mm:ss"/>
            <beans:write name="transaction" property="person"/>:<beans:write name="transaction" property="user"/>
        </span><br/>
        <span class="history-text">
            <logic:iterate name="transaction" property="rows" id="row">
                <span class="history-label"><beans:write name="row" property="name"/>:</span>
                <logic:equal name="row" property="value" value="">
                    <i>blank</i>
                </logic:equal>
                <logic:notEqual name="row" property="value" value="">
                    <velocityme:markup><beans:write name="row" property="value"/></velocityme:markup>
                </logic:notEqual>
                <br/>
            </logic:iterate>
            <logic:present name="transaction" property="fileAttachmentValue">
                <b>Attachment:</b>
                <html:link action="attachment.do" paramId="name" paramName="transaction" paramProperty="fileAttachmentValue.serverName" target = "#xyz">
                    <beans:write name="transaction" property="fileAttachmentValue.name"/>
                </html:link>
            </logic:present>
        </span></p>
    </logic:iterate>
</div>
